const path = require('path');
const fs = require('fs');

const fpath = '/a/b/c/index.html';  // 定义文件的存放路径

const fullName = path.basename(fpath);
console.log(fullName);

// 如果不想获取到，文件的后缀名
const nameWithoutExt = path.basename(fpath, '.html');
console.log(nameWithoutExt);